package com.wanglei.rdd.transform

import org.apache.spark.{SparkConf, SparkContext}

object Spark10_coalesce {

  def main(args: Array[String]): Unit = {

    //
    val conf = new SparkConf().setMaster("local[2]").setAppName("map")
    val sc = new SparkContext(conf)


    // coalesce 默认不会有shuffle
    val rdd = sc.makeRDD(List("hello", "scala", "hello", "spark"), 4)
    rdd.coalesce(2).saveAsTextFile("output")


    //
    sc.stop()

  }

}
